<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="keywords" content="" />
    <meta name="author" content="Ckryo">
    <link rel="icon" href="/favicon.ico">
    <!-- page title -->
    <title>LY'S-BLOG</title>
    <!-- bootstrap css -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet">
    <!-- css -->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/magnific-popup.css" rel="stylesheet">
    <!-- fonts -->
    <link href="/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='/fonts/FontAwesome.otf' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="/css/linear-icons.css">
    <link rel="stylesheet" href="/css/share.min.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="/https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
    <!-- javascript -->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/jquery.easing.min.js"></script>
</head>
<body data-spy="scroll" data-target="#post-scroll-spy">
    <!-- preloader -->
    <div id="preloader">
        <div class="spinner spinner-round"></div>
    </div>
    <!-- / preloader -->
    <!-- header -->
    <header>
        <!-- nav -->
        <nav class="navbar navbar-default">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-logo" href="/index.html">
                        LY'S blog
                    </a>
                </div>
                <!-- / navbar-header -->
                
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                    	
                        <li>
	                        <a href="/project/index.html">
	                        	
	                        	<span>项目</span>
	                        </a>
                        </li>
                        
                        <li>
	                        <a href="/post/index.html">
	                        	
	                        	<span>文章</span>
	                        </a>
                        </li>
                        
                        <li>
	                        <a href="/about.html">
	                        	
	                        	<span>关于我</span>
	                        </a>
                        </li>
                        
                    </ul>
                </div>
                
                <!--/ nav-collapse -->
            <!-- / container -->
        </nav>
        <!-- / nav -->
        <!-- header-banner -->
        <div id="header-banner" class="demo-1"  style="background-image: url(/images/banner-bg.jpg)" >
    <div class="banner-content text-center">
        <div class="banner-info">
            <h1 id="banner-title">罗渊的博客</h1>
            <p id="banner-description" style="display: none" data-in-effect="rotateInUpRight">
                追求知识的小星星
            </p>
        </div>
        <!-- / banner-info -->
    </div>
    <!-- / banner-content -->
</div>
        <!-- / header-banner -->
    </header>
    <!-- / header -->
    <!-- / content -->
    <link rel="stylesheet" href="/css/i_slidebar.css">
<link rel="stylesheet" href="/css/i_post.css">
<div id="page-content" class="container">
    <!-- post content + sidebar -->
    <section id="blog">
        <div class="row">
            <!-- post content area -->
            <div class="col-md-9">
                <div class="blog block post-content-area">
                    <img src="/css/images/usercase.svg" alt="">
                    <div class="post-info-box">
                        <h1 style="font-size: 48px;">文档管理系统简要分析</h1>
                        <p class="post-info" style="margin-bottom: 15px;">
                            发表于:
                            <span style="color: #aaa; margin: 0 15px">
                                2017.11.14
                            </span>
                             | 分类：
                             <a href="#" style="margin: 0 5px">
                                
                                    -
                                
                             </a>

                             <!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->
                                

                             
                        </p>
                        <blockquote>
<p>最近项目组在做一个<code>文档管理系统</code>，主要是面向艺术学院，用于管理平时的PSD文件和创作视频。</p>
</blockquote>
<h3 id="1-需求分析"><a href="#1-需求分析" class="headerlink" title="1. 需求分析"></a>1. 需求分析</h3><a id="more"></a>
<h4 id="1-1-需求概述"><a href="#1-1-需求概述" class="headerlink" title="1.1 需求概述"></a>1.1 需求概述</h4><pre><code>1. 学生未登录时可以进行文件的缩略图预览；
2. 学生可以进行注册，但需要超级管理员审核之后才能通过；
3. 学生登录之后可以进行资源的下载；
4. 专业管理员负责上传本专业的资源文档，同时可以进行文档的删除；
5. 超级管理员可以创建和删除专业管理员和学生用户。
</code></pre><h3 id="2-UML-建模"><a href="#2-UML-建模" class="headerlink" title="2. UML 建模"></a>2. UML 建模</h3><hr>
<h4 id="2-1-用例图"><a href="#2-1-用例图" class="headerlink" title="2.1 用例图"></a>2.1 用例图</h4><p><img src="/css/images/usercase.svg" alt="usercase"></p>
<h4 id="2-2-类图"><a href="#2-2-类图" class="headerlink" title="2.2 类图"></a>2.2 类图</h4><p><img src="/css/images/class.svg" alt="class"></p>
<h3 id="3-数据库设计"><a href="#3-数据库设计" class="headerlink" title="3. 数据库设计"></a>3. 数据库设计</h3><h4 id="3-1-E-R图"><a href="#3-1-E-R图" class="headerlink" title="3.1 E-R图"></a>3.1 E-R图</h4><p>用户与文件之间<br><img src="/css/images/er.svg" alt="er"></p>
<h4 id="3-2-表结构"><a href="#3-2-表结构" class="headerlink" title="3.2 表结构"></a>3.2 表结构</h4><p><img src="/css/images/shujuku.png" alt="shujuku"></p>
<h4 id="3-3-SQL文件"><a href="#3-3-SQL文件" class="headerlink" title="3.3 SQL文件"></a>3.3 SQL文件</h4><p><a href="https://github.com/gitlilys/TeachingResource/tree/Test/TeachingResource/db" target="_blank" rel="noopener">SQL文件</a></p>
<h3 id="4-框架搭建"><a href="#4-框架搭建" class="headerlink" title="4. 框架搭建"></a>4. 框架搭建</h3><hr>
<h4 id="4-1-SSM-框架简介"><a href="#4-1-SSM-框架简介" class="headerlink" title="4.1 SSM 框架简介"></a>4.1 SSM 框架简介</h4><blockquote>
<p>项目包结构</p>
</blockquote>
<p><img src="/css/images/package.png" alt="package"></p>
<p>   一般来说呢，在controller包里写一些控制类，负责处理从客户端得到的请求。接下来在service包里写一些业务接口，在serviceImpl包里负责具体实现。dao包里写和数据库相关的操作，将对应的Mapper.xml放在这个包里。domain包放JavaBean类，也就是我们的实体类，Utils包里放一些静态工具类，方便各种操作。这里推荐使用apache-commons这个经典的工具包，里面有很多很实用的工具类。</p>
<blockquote>
<p>框架配置</p>
</blockquote>
<p>![peizhi]/css/images/peizhi.png)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">重点关注这几个配置文件的配置，都有注释。</span><br></pre></td></tr></table></figure>
<blockquote>
<p>一个简单的使用</p>
</blockquote>
<p><img src="/css/images/lizi.png" alt="lizi"></p>
<p>写一个简单的注册的例子:<br>准备阶段，将sql文本导入数据库，数据库名<strong>teachingresource</strong></p>
<p>首先，写一个JSP页面。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">%@</span> <span class="attr">page</span> <span class="attr">language</span>=<span class="string">"java"</span> <span class="attr">contentType</span>=<span class="string">"text/html; charset=utf-8"</span></span></span><br><span class="line"><span class="tag">    <span class="attr">pageEncoding</span>=<span class="string">"utf-8"</span>%&gt;</span></span><br><span class="line"><span class="meta">&lt;!DOCTYPE html&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"en"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">title</span>&gt;</span>Register<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"viewport"</span> <span class="attr">content</span>=<span class="string">"width=device-width, initial-scale=1"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">http-equiv</span>=<span class="string">"Content-Type"</span> <span class="attr">content</span>=<span class="string">"text/html; charset=utf-8"</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">meta</span> <span class="attr">name</span>=<span class="string">"keywords"</span> <span class="attr">content</span>=<span class="string">"Awesome Login Form Responsive Widget,皮卡丘,Login form widgets, Sign up Web forms , Login signup Responsive web form,Flat Pricing table,Flat Drop downs,Registration Forms,News letter Forms,Elements"</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">form</span> <span class="attr">action</span>=<span class="string">"$&#123;pageContext.request.contextPath&#125;/TeRe/regester"</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">onsubmit</span>=<span class="string">"return isValid(this);"</span> &gt;</span></span><br><span class="line">		用户名:  <span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">"name"</span> <span class="attr">type</span>=<span class="string">"text"</span>&gt;</span> <span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line">		密码:    <span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">"password"</span> <span class="attr">type</span>=<span class="string">"password"</span>&gt;</span> <span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line">		确认密码:<span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">"rqpassword"</span> <span class="attr">type</span>=<span class="string">"password"</span>&gt;</span> <span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"注册"</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>写一个处理类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.TeRe.controller;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletRequest;</span><br><span class="line"><span class="keyword">import</span> javax.servlet.http.HttpServletResponse;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Controller;</span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestMapping;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.TeRe.Utils.BaseUtils;</span><br><span class="line"><span class="keyword">import</span> com.TeRe.domain.User;</span><br><span class="line"><span class="keyword">import</span> com.TeRe.service.SystemManageService;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 罗渊</span></span><br><span class="line"><span class="comment"> * 2017年11月15日</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"></span><br><span class="line"><span class="meta">@Controller</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SystemManageController</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Autowired</span></span><br><span class="line">	<span class="keyword">private</span> SystemManageService systemManageService;</span><br><span class="line"></span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 *</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> request</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> response</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="meta">@RequestMapping</span>(value=<span class="string">"/TeRe/regester"</span>)</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">regester</span><span class="params">(HttpServletRequest request, HttpServletResponse response)</span></span>&#123;</span><br><span class="line">		User user = <span class="keyword">new</span> User();</span><br><span class="line">		String username = request.getParameter(<span class="string">"name"</span>);</span><br><span class="line">		String password = request.getParameter(<span class="string">"password"</span>) + <span class="string">"&#123;"</span> + username + <span class="string">"&#125;"</span>;</span><br><span class="line">		user.setUser_id(BaseUtils.getUUID());		</span><br><span class="line">		user.setUser_name(username);</span><br><span class="line">		user.setUser_password(BaseUtils.enCode(password));</span><br><span class="line">		user.setUser_role(<span class="number">1</span>);</span><br><span class="line">		user.setUser_enable(<span class="number">0</span>);</span><br><span class="line">		systemManageService.addUser(user);</span><br><span class="line"></span><br><span class="line">		<span class="keyword">return</span> <span class="string">"redirect:/success.jsp"</span>;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>写一个UserBean</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.TeRe.domain;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Date;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 罗渊</span></span><br><span class="line"><span class="comment"> * 2017年11月15日</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">User</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	String user_id;</span><br><span class="line">	String user_name;</span><br><span class="line">	String user_password;</span><br><span class="line">	<span class="keyword">int</span> user_role;</span><br><span class="line">	Date user_cretetime;</span><br><span class="line">	<span class="keyword">int</span> user_enable;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getUser_id</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_id;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_id</span><span class="params">(String user_id)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_id = user_id;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getUser_name</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_name;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_name</span><span class="params">(String user_name)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_name = user_name;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getUser_password</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_password;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_password</span><span class="params">(String user_password)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_password = user_password;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getUser_role</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_role;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_role</span><span class="params">(<span class="keyword">int</span> user_role)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_role = user_role;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> Date <span class="title">getUser_cretetime</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_cretetime;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_cretetime</span><span class="params">(Date user_cretetime)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_cretetime = user_cretetime;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getUser_enable</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> user_enable;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setUser_enable</span><span class="params">(<span class="keyword">int</span> user_enable)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.user_enable = user_enable;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>编写service接口</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.TeRe.service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.TeRe.domain.User;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 罗渊</span></span><br><span class="line"><span class="comment"> * 2017年11月15日</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">SystemManageService</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">addUser</span><span class="params">(User user)</span></span>;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>编写service实现类</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.TeRe.serviceImpl;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;</span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.TeRe.dao.SystemManageDao;</span><br><span class="line"><span class="keyword">import</span> com.TeRe.domain.User;</span><br><span class="line"><span class="keyword">import</span> com.TeRe.service.SystemManageService;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 罗渊</span></span><br><span class="line"><span class="comment"> * 2017年11月15日</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Service</span>(<span class="string">"SystemManageService"</span>)</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SystemManageServiceImpl</span> <span class="keyword">implements</span> <span class="title">SystemManageService</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Autowired</span></span><br><span class="line">	<span class="keyword">private</span> SystemManageDao systemMangeDao;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">addUser</span><span class="params">(User user)</span> </span>&#123;</span><br><span class="line">		systemMangeDao.addUser(user);</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>编写dao</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.TeRe.dao;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> com.TeRe.domain.User;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 罗渊</span></span><br><span class="line"><span class="comment"> * 2017年11月15日</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">SystemManageDao</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">addUser</span><span class="params">(User user)</span></span>;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;</span><br><span class="line"><span class="meta">&lt;!DOCTYPE mapper</span></span><br><span class="line"><span class="meta">PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"</span></span><br><span class="line"><span class="meta">"http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">mapper</span> <span class="attr">namespace</span>=<span class="string">"com.TeRe.dao.SystemManageDao"</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">insert</span> <span class="attr">id</span>=<span class="string">"addUser"</span> <span class="attr">parameterType</span>=<span class="string">"com.TeRe.domain.User"</span>&gt;</span></span><br><span class="line">		insert into tb_user values(#&#123;user_id&#125;,#&#123;user_name&#125;,#&#123;user_password&#125;,#&#123;user_role&#125;,#&#123;user_cretetime&#125;,#&#123;user_enable&#125;)</span><br><span class="line">	<span class="tag">&lt;/<span class="name">insert</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">mapper</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>以上例子实现了一个简单的注册功能。<br>注意注解的使用。</p>

                    </div>
                    <!-- / post-info-box -->
                </div>
                <!-- / blog-block -->
            </div>
            <!-- / col-md-9 -->
            <!-- / post content area -->
            <style type="text/css">
.post-tab-header {
    width: 100%;
    padding: 5px 50px;
    height: 40px;
    margin-bottom: 10px;
}

.post-tab-header li {
    width: 50%;
    float: left;
    text-align: center;
    cursor: pointer;
    padding-bottom: 10px;
}

.post-tab-header li.active {
    color: #c39d6d;
    border-bottom: 1px solid #c39d6d;
}

.post-tab-content .post-tab-item {
    display: none;
}

.post-tab-content .post-tab-item.active {
    display: block;
}

@keyframes MinefadeInUp {
    from {
        opacity: 0;
        transform: translateY(45px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.MinefadeInUp {
    animation-name: MinefadeInUp;
}

ol,
ul,
li {
    list-style: none;
}

.post-toc {
    font-size: 14px;
    color: #666;
    overflow: auto;
}

.post-toc .nav-link {
    padding: 0px;
}

.post-toc ol {
    margin: 0;
    padding: 5px 0 5px 20px;
    text-align: left;
    list-style: none;
    font-size: 14px;
}

.post-toc ol>ol {
    padding-left: 0;
}

.post-toc ol a {
    transition-duration: 0.2s;
    transition-timing-function: ease-in-out;
    transition-delay: 0s;
    transition-property: all;
    color: #666;
    border-bottom-color: #ccc;
}

.post-toc ol a:hover {
    color: #000;
    border-bottom-color: #000;
}

.post-toc .nav-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.8;
}

.post-toc .nav .nav-child {
    display: none;
}

.post-toc .nav .active>.nav-child {
    display: block;
}

.post-toc .nav .active-current>.nav-child {
    display: block;
}

.post-toc .nav .active-current>.nav-child>.nav-item {
    display: block;
}

.post-toc .nav .active>a {
    color: #c39d6d;
    border-bottom-color: #c39d6d;
}

.post-toc .nav .active-current>a {
    color: #c39d6d;
}

.post-toc .nav .active-current>a:hover {
    color: #c39d6d;
}
</style>
<!-- post sidebar area -->
<div class="col-md-3">
    <div class="blog-sidebar" data-spy="affix" data-offset-top="627">
        <ul class="post-tab-header">
            <li class="active" data-index="0">文章目录</li>
            <li data-index="1">站点概览</li>
        </ul>
        <div style="clear: both"></div>
        <div class="post-tab-content">
            <div id="post-scroll-spy" data-index="0" class="active post-tab-item animated MinefadeInUp">
                <div class="post-toc">
                    <ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-需求分析"><span class="nav-number">1.</span> <span class="nav-text">1. 需求分析</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-1-需求概述"><span class="nav-number">1.1.</span> <span class="nav-text">1.1 需求概述</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-UML-建模"><span class="nav-number">2.</span> <span class="nav-text">2. UML 建模</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-1-用例图"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 用例图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-类图"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 类图</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-数据库设计"><span class="nav-number">3.</span> <span class="nav-text">3. 数据库设计</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-1-E-R图"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 E-R图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-表结构"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 表结构</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-3-SQL文件"><span class="nav-number">3.3.</span> <span class="nav-text">3.3 SQL文件</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-框架搭建"><span class="nav-number">4.</span> <span class="nav-text">4. 框架搭建</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-SSM-框架简介"><span class="nav-number">4.1.</span> <span class="nav-text">4.1 SSM 框架简介</span></a></li></ol></li></ol>
                </div>
            </div>
            <div data-index="1" class="post-tab-item animated MinefadeInUp">
                <div class="blog block post-sidebar-widget">
    <img class="site-author-image" src="/images/my.jpg">
    <p class="site-author-name">阿文</p>
    <p class="site-author-description">Vimer</p>
    <!-- <div class="feed-link motion-element">
                        <a href="/atom.xml" rel="alternate">
                            <i class="fa fa-rss"></i> RSS
                        </a>
                    </div> -->
    <nav class="site-state motion-element">
        <div class="site-state-item site-state-posts">
            <a href="/archives">
                <!-- 计算文章 和 项目总数量 -->
                
                <span class="site-state-item-count">26</span>
                <span class="site-state-item-name">文章</span>
            </a>
        </div>
        <div class="site-state-item site-state-categories">
            <a href="/categories">
	            <span class="site-state-item-count">0</span>
	            <span class="site-state-item-name">项目</span>
            </a>
        </div>
    </nav>
</div>
            </div>
        </div>
    </div>
</div>
<!-- / col-sm-4 col-md-3 -->
<!-- / post sidebar area -->
<script type="text/javascript">
$(function() {
    $('.post-tab-header').on('click', 'li', function() {
        if ($(this).hasClass('active')) return;
        $('.post-tab-header li').removeClass('active');
        $('.post-tab-content .post-tab-item').removeClass('active');
        $(this).addClass('active');
        var index = $(this).data('index');
        $('.post-tab-content').find('.post-tab-item[data-index=' + index + ']').addClass('active');
    });
});
</script>
        </div>
        <!-- / row -->
    </section>
    <!-- / post content + sidebar -->
</div>

        <!-- / content -->
</body>
<!-- footer -->
<footer>
    <div class="container">
        <p class="footer-info">© Made by gitlily</p>
    </div>
    <!-- / container -->
</footer>
<!-- / footer -->
<!-- portfolio -->
<script src="/js/custom.js"></script>
<script src="/js/jquery.shuffle.min.js"></script>
<!-- lightbox -->
<script src="/js/jquery.magnific-popup.min.js"></script>
<!-- / lightbox -->
<!-- / portfolio -->
<!-- preloader -->
<script src="/js/preloader.js"></script>
<!-- / preloader -->
<!-- / javascript -->
<script src="/js/jquery.lettering.js"></script>
<script src="/js/jquery.textillate.js"></script>
<script>
$(function() {
    $('#banner-title').textillate({
        in: {
            // set the effect name
            effect: 'fadeInDown',
            callback: function() {
                $('#banner-description').css('display', 'block');
                $('#banner-description').textillate();
            }
        },
        // set the type of token to animate (available types: 'char' and 'word')
        type: 'char'
    });
});
</script>

</html>